package com.yh.model;

import com.sun.istack.internal.NotNull;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "house")
@Getter
@Setter
@NoArgsConstructor
@ToString
//@SqlResultSetMapping(name = "housemodelmapping",entities = @EntityResult(entityClass = HouseModel.class))
//@org.hibernate.annotations.NamedNativeQuery(name = "findall",query = "select * from house",resultSetMapping = "housemodelmapping")
public class HouseModel implements Serializable {

    @Id
    @NotNull
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int hid;

    @Column
    private String title;

    @Column
    private int type;

    @OneToOne
    @JoinColumn(name = "type",insertable = false,updatable = false)
    private HouseTypeModel houseTypeModel;

    @Column
    private String area;

    @Column
    private String price;

    @Column
    private String date;

    @Column
    private int town;

    @OneToOne
    @JoinColumn(name = "town",insertable = false,updatable = false)
    private TownModel townModel;

    @Column
    private String street;

    @OneToOne
    @JoinColumn(name = "street",insertable = false,updatable = false)
    private StreetModel streetModel;

    @Column
    private String phone;

    @Column
    private String context;

    @Column
    private int userid;

    @OneToOne
    @JoinColumn(name = "userid",insertable = false,updatable = false)
    private UserModel userModel;


}
